package com.zxm.ssm.mapper;

import com.zxm.ssm.entity.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProductMapper {
    @Select("select * from product")
    List<Product> findAll();

    @Delete("delete from product where id = #{id}")
    int deleteProduct(int id);

    @Update("update product set name=#{name},intro=#{intro},price=#{price},count=#{count},picture=#{picture},number=#{number},address=#{address},createTime=#{createTime} where id = #{id}")
    int updateProduct(Product product);

    @Insert("insert into product values(default,#{name},#{intro},#{price},#{count},#{picture},#{number},#{address},#{createTime})")
    int insertProduct(Product product);

    @Select("select * from product where id = #{id}")
    Product findById(int id);
}
